<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="text" />
  <xsl:param name="languageCode" />
  <!--
	if a label does not exist, which language to use as the default
-->
  <xsl:variable name="defaultLanguageCode">1033</xsl:variable>
  <xsl:template match="/entity"><![CDATA[<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0" exclude-result-prefixes="msxsl">]]><![CDATA[<xsl:output method="html" indent="no"/>]]><![CDATA[<xsl:param name="numberFormat"/>]]><![CDATA[<xsl:param name="numberFormatMask"/>]]><![CDATA[<xsl:param name="currencySymbol"/>]]><![CDATA[<xsl:param name="privilegeId"/>]]><!--
		set the number format to use for format-number() later
	--><![CDATA[<xsl:decimal-format name="us" grouping-separator="," decimal-separator="."/>]]><![CDATA[<xsl:decimal-format name="eu" grouping-separator="." decimal-separator=","/>]]><![CDATA[<xsl:decimal-format name="fr" grouping-separator=" " decimal-separator=","/>]]><![CDATA[<xsl:decimal-format name="nz" grouping-separator="'" decimal-separator="."/>]]><!--
		helper function used in the number formatting process
	--><![CDATA[<xsl:template name="replace">]]><![CDATA[<xsl:param name="source" />]]><![CDATA[<xsl:param name="oldVal" />]]><![CDATA[<xsl:param name="newVal" />]]><![CDATA[<xsl:variable name="temp" select="$source" />]]><![CDATA[<xsl:variable name="first" select="substring-before($temp, $oldVal)" />]]><![CDATA[<xsl:variable name="rest" select="substring-after($temp, $oldVal)" />]]><![CDATA[<xsl:value-of select="concat($first, $newVal)" />]]><![CDATA[<xsl:choose>]]><![CDATA[<xsl:when test="(substring-before($rest, $oldVal)) or (substring-after($rest, $oldVal))">]]><![CDATA[<xsl:call-template name="replace">]]><![CDATA[<xsl:with-param name="source" select="$rest" />]]><![CDATA[<xsl:with-param name="oldVal" select="$oldVal" />]]><![CDATA[<xsl:with-param name="newVal" select="$newVal" />]]><![CDATA[</xsl:call-template>]]><![CDATA[</xsl:when>]]><![CDATA[<xsl:otherwise>]]><![CDATA[<xsl:value-of select="$rest" />]]><![CDATA[</xsl:otherwise>]]><![CDATA[</xsl:choose>]]><![CDATA[</xsl:template>]]><![CDATA[<xsl:template match="/]]><xsl:value-of select="@name" /><![CDATA[">]]><!--
			write out scripted events if there are any
		--><xsl:if test="/entity/form/tabs/tab/sections/section/rows/row/cell/events/event[@active = 'true']"><![CDATA[<script language="javascript">]]><xsl:for-each select="/entity/form/tabs/tab/sections/section/rows/row/cell/events/event[@active = 'true']"><![CDATA[
						function ]]><xsl:value-of select="../../@name" /><![CDATA[_]]><xsl:value-of select="@name" /><![CDATA[()
						{
							try
							{
								]]><xsl:value-of select="script" /><![CDATA[
							}
							catch(e)
							{
								alert("There was an error with this field\'s customized event.\n\nField: " + ]]><xsl:value-of select="../../@name" /><![CDATA[ + "\n\nEvent: " + ]]><xsl:value-of select="@name" /><![CDATA[ + "\n\nError: " + e.description);
							}
						}
					]]></xsl:for-each><![CDATA[</script>]]></xsl:if><![CDATA[<table width="100%" height="100%" cellspacing="0" cellpadding="0">]]><![CDATA[<form name="crmForm" class="crm">]]><![CDATA[<input type="hidden" name="crmFormRootElem" value="]]><xsl:value-of select="@name" /><![CDATA["/>]]><!--
					write out the hidden data fields
				--><xsl:for-each select="form/data"><xsl:variable name="fieldName" select="@name" /><xsl:if test="not(/entity/form/tabs/tab/sections/section/rows/row/cell[@name = $fieldName])"><xsl:choose><xsl:when test="/entity/metadata/fields/field[@name = $fieldName]/@datatype = 'lookup'"><![CDATA[<input type="hidden" name="]]><xsl:value-of select="@name" /><![CDATA[">]]><![CDATA[<xsl:if test="not(]]><xsl:value-of select="@name" /><![CDATA[/@dsc) or ]]><xsl:value-of select="@name" /><![CDATA[/@dsc = 0">]]><![CDATA[<xsl:attribute name="value"><xsl:value-of select="]]><xsl:value-of select="@name" /><![CDATA["/></xsl:attribute>]]><![CDATA[</xsl:if>]]><![CDATA[</input>]]></xsl:when><xsl:otherwise><![CDATA[<input type="hidden" name="]]><xsl:value-of select="$fieldName" /><![CDATA["><xsl:attribute name="value"><xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA["/></xsl:attribute></input>]]></xsl:otherwise></xsl:choose></xsl:if></xsl:for-each><!--
					write out the tabs
				--><![CDATA[<tr height="25">]]><![CDATA[<td>]]><![CDATA[<table cellspacing="0" cellpadding="0" class="tabBar" onafterchange="crmForm.SetTabFocus();">]]><![CDATA[<tr>]]><![CDATA[<td id="tabs" nowrap="" valign="bottom">]]><xsl:for-each select="form/tabs/tab"><![CDATA[<span tabindex="0" class="tab]]><xsl:if test="position() = 1"> tabOn</xsl:if><![CDATA[" tabID="tab]]><xsl:value-of select="position() - 1" /><![CDATA[">]]><xsl:choose><xsl:when test="labels/label[@languagecode = $languageCode]"><xsl:value-of select="labels/label[@languagecode = $languageCode]/@description" /></xsl:when><xsl:otherwise><xsl:value-of select="labels/label[@languagecode = 1033]/@description" /></xsl:otherwise></xsl:choose><![CDATA[</span>]]></xsl:for-each><![CDATA[</td>]]><![CDATA[</tr>]]><![CDATA[</table>]]><![CDATA[<hr id="hrSelectedTab" class="tabGlow"/>]]><![CDATA[<hr id="hrGlowTab" class="tabGlow"/>]]><![CDATA[</td>]]><![CDATA[</tr>]]><!--
					write out the contents of the tabs
				--><![CDATA[<tr>]]><![CDATA[<td valign="top">]]><xsl:for-each select="form/tabs/tab"><![CDATA[<div class="tab" id="tab]]><xsl:value-of select="position() - 1" /><![CDATA["]]><xsl:if test="position() = 1"><![CDATA[ style="display:inline;"]]></xsl:if><![CDATA[>]]><![CDATA[<table width="100%" cellspacing="0" cellpadding="3" style="table-layout:fixed;">]]><![CDATA[<col width="115"/><col/><col width="135" style="padding-left:20px;"/><col/>]]><xsl:for-each select="sections/section"><xsl:variable name="sectionName" select="@name" /><xsl:variable name="sectionLabel"><xsl:choose><xsl:when test="labels/label[@languagecode = $languageCode]"><xsl:value-of select="labels/label[@languagecode = $languageCode]/@description" /></xsl:when><xsl:otherwise><xsl:value-of select="labels/label[@languagecode = 1033]/@description" /></xsl:otherwise></xsl:choose></xsl:variable><!--
												get a count of all the cell elements in all the preceding tabs for setting the tabindex
											--><xsl:variable name="previousTabsCells" select="count(/entity/form/tabs/tab[sections/section[@name = $sectionName]]/preceding-sibling::tab/sections/section/rows/row/cell)" /><xsl:variable name="previousSectionCells" select="count(/entity/form/tabs/tab/sections/section[@name = $sectionName]/preceding-sibling::section/rows/row/cell)" /><!--
													write out the section header
												--><xsl:choose><!--
														if it's the first section on a tab and the label is not being shown, we don't want the extra white space in there
													--><xsl:when test="position() = 1"><xsl:if test="@showlabel = 'true'"><xsl:call-template name="sectionHeader"><xsl:with-param name="sectionLabel" select="$sectionLabel" /></xsl:call-template></xsl:if></xsl:when><xsl:otherwise><xsl:call-template name="sectionHeader"><xsl:with-param name="sectionLabel" select="$sectionLabel" /></xsl:call-template></xsl:otherwise></xsl:choose><!--
													write out each row
												--><xsl:for-each select="rows/row"><![CDATA[<tr>]]><xsl:choose><!--
																cell spans both columns
															--><xsl:when test="not(cell[2])"><xsl:variable name="fieldName" select="cell[1]/@name" /><xsl:variable name="previousCells" select="count(/entity/form/tabs/tab/sections/section[rows/row/cell/@name = $fieldName]/rows/row[cell/@name = $fieldName]/preceding-sibling::row) + 1" /><xsl:apply-templates select="cell[1]"><xsl:with-param name="colspan">true</xsl:with-param><xsl:with-param name="tabIndex"><xsl:value-of select="($previousTabsCells + $previousSectionCells + $previousCells) * 5" /></xsl:with-param></xsl:apply-templates></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="cell[1]/@name"><xsl:variable name="fieldName" select="cell[1]/@name" /><xsl:variable name="previousCells" select="count(/entity/form/tabs/tab/sections/section[rows/row/cell/@name = $fieldName]/rows/row[cell/@name = $fieldName]/preceding-sibling::row) + 1" /><xsl:apply-templates select="cell[1]"><xsl:with-param name="colspan">false</xsl:with-param><xsl:with-param name="tabIndex"><xsl:value-of select="($previousTabsCells + $previousSectionCells + $previousCells) * 5" /></xsl:with-param></xsl:apply-templates></xsl:when><xsl:otherwise><![CDATA[<td></td>]]><![CDATA[<td></td>]]></xsl:otherwise></xsl:choose><xsl:choose><xsl:when test="cell[2]/@name"><xsl:variable name="fieldName" select="cell[2]/@name" /><xsl:variable name="previousCells" select="count(/entity/form/tabs/tab/sections/section[rows/row/cell/@name = $fieldName]/rows/row[cell/@name = $fieldName]/preceding-sibling::row) + count(/entity/form/tabs/tab/sections/section[rows/row/cell/@name = $fieldName]/rows/row) + 1" /><xsl:apply-templates select="cell[2]"><xsl:with-param name="colspan">false</xsl:with-param><xsl:with-param name="tabIndex"><xsl:value-of select="($previousTabsCells + $previousSectionCells + $previousCells) * 5" /></xsl:with-param></xsl:apply-templates></xsl:when><xsl:otherwise><![CDATA[<td></td>]]><![CDATA[<td></td>]]></xsl:otherwise></xsl:choose></xsl:otherwise></xsl:choose><![CDATA[</tr>]]></xsl:for-each><![CDATA[<tr height="10">]]><![CDATA[<td></td>]]><![CDATA[</tr>]]></xsl:for-each><![CDATA[</table>]]><![CDATA[</div>]]></xsl:for-each><![CDATA[</td>]]><![CDATA[</tr>]]><![CDATA[</form>]]><!--
				write out the form that collects the data for submitting client-side
			--><![CDATA[<form name="crmFormSubmit" method="post">]]><![CDATA[<input type="hidden" name="crmFormSubmitXml"/>]]><![CDATA[<input type="hidden" name="crmFormSubmitMode"/>]]><![CDATA[<input type="hidden" name="crmFormSubmitObjectType" value="]]><xsl:value-of select="@objecttypecode" /><![CDATA["/>]]><![CDATA[<input type="hidden" name="crmFormSubmitId">]]><![CDATA[<xsl:attribute name="value">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="@name" />id<![CDATA["/>]]><![CDATA[</xsl:attribute>]]><![CDATA[</input>]]><![CDATA[<input type="hidden" name="crmFormSubmitSecurity">]]><![CDATA[<xsl:attribute name="value">]]><![CDATA[<xsl:value-of select="$privilegeId"/>]]><![CDATA[</xsl:attribute>]]><![CDATA[</input>]]><![CDATA[</form>]]><![CDATA[</table>]]><![CDATA[</xsl:template>]]><![CDATA[</xsl:stylesheet>]]></xsl:template>
  <!--
	writes out the section header in the proper format
-->
  <xsl:template name="sectionHeader">
    <xsl:param name="sectionLabel" /><![CDATA[<tr>]]><![CDATA[<td colspan="4" class="sec]]><xsl:if test="@showbar = 'true'"> bar</xsl:if><![CDATA[">]]><xsl:if test="@showlabel = 'true'"><xsl:value-of select="$sectionLabel" /></xsl:if><![CDATA[</td>]]><![CDATA[</tr>]]><![CDATA[<tr height="5">]]><![CDATA[<td></td>]]><![CDATA[</tr>]]></xsl:template>
  <!--
	writes out the cell
-->
  <xsl:template match="/entity/form/tabs/tab/sections/section/rows/row/cell">
    <!--
		does this cell span multiple columns?
	-->
    <xsl:param name="colspan" />
    <xsl:param name="tabIndex" />
    <!--
		populate local variables
	-->
    <xsl:variable name="fieldName" select="@name" />
    <xsl:variable name="dataType" select="/entity/metadata/fields/field[@name = $fieldName]/@datatype" />
    <xsl:variable name="maxLength" select="/entity/properties/fields/field[@name = $fieldName]/@maxlength" />
    <xsl:variable name="defaultValue" select="/entity/properties/fields/field[@name = $fieldName]/@defaultvalue" />
    <xsl:variable name="format" select="/entity/properties/fields/field[@name = $fieldName]/@format" />
    <xsl:variable name="minValue" select="/entity/properties/fields/field[@name = $fieldName]/@minvalue" />
    <xsl:variable name="maxValue" select="/entity/properties/fields/field[@name = $fieldName]/@maxvalue" />
    <xsl:variable name="showGrouping" select="/entity/properties/fields/field[@name = $fieldName]/@grouping" />
    <xsl:variable name="decAccuracy" select="/entity/properties/fields/field[@name = $fieldName]/@accuracy" />
    <xsl:variable name="isRequired" select="/entity/metadata/fields/field[@name = $fieldName]/@requiredforplatform" />
    <xsl:variable name="requiredLevel" select="/entity/properties/fields/field[@name = $fieldName]/@requiredlevel" />
    <xsl:variable name="cellState">
      <xsl:choose>
        <xsl:when test="/entity/metadata/fields/field[@name = $fieldName]/@validforcreateapi = 'true'">
          <xsl:text>editable</xsl:text>
        </xsl:when>
        <xsl:otherwise>
          <xsl:text>readonly</xsl:text>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <!--
		sets expando on input element if it's a required field
	-->
    <xsl:variable name="req">
      <xsl:if test="$cellState = 'editable' and ($isRequired = 'true' or $requiredLevel = 'required')">
        <xsl:text> req="1"</xsl:text>
      </xsl:if>
    </xsl:variable>
    <!--
		writes out the cell label
	--><![CDATA[<td]]><xsl:choose><xsl:when test="$isRequired = 'true'"> class="req"</xsl:when><xsl:when test="$requiredLevel = 'required'"> class="req"</xsl:when><xsl:when test="$requiredLevel = 'recommended'"> class="rec"</xsl:when><xsl:otherwise> class="n"</xsl:otherwise></xsl:choose><xsl:if test="$dataType = 'memo' or $format = 'textarea'"> style="vertical-align:top;"</xsl:if><![CDATA[>]]><xsl:choose><xsl:when test="labels/label[@languagecode = $languageCode]"><xsl:value-of select="labels/label[@languagecode = $languageCode]/@description" /></xsl:when><xsl:otherwise><xsl:value-of select="labels/label[@languagecode = 1033]/@description" /></xsl:otherwise></xsl:choose><xsl:choose><xsl:when test="$dataType = 'money'"><![CDATA[ (<xsl:value-of select="$currencySymbol"/>)]]></xsl:when></xsl:choose><![CDATA[</td>]]><![CDATA[<td]]><xsl:if test="$colspan = 'true'"> colspan="3"</xsl:if><![CDATA[>]]><xsl:choose><!--
				boolean datatype
			--><xsl:when test="$dataType = 'boolean'"><![CDATA[<table cellpadding="0" cellspacing="0">]]><![CDATA[<tr>]]><xsl:for-each select="/entity/properties/fields/field[@name = $fieldName]/options/option"><!--
								get the option label 
							--><xsl:variable name="optionLabel"><xsl:choose><xsl:when test="labels/label[@languagecode = $languageCode]"><xsl:value-of select="labels/label[@languagecode = $languageCode]/@description" /></xsl:when><xsl:otherwise><xsl:value-of select="labels/label[@languagecode = 1033]/@description" /></xsl:otherwise></xsl:choose></xsl:variable><!--
								write out the radio buttons and labels
							--><![CDATA[<td>]]><![CDATA[<input tabindex="]]><xsl:value-of select="$tabIndex + position() - 1" /><![CDATA[" ]]><xsl:if test="$cellState = 'readonly'"><![CDATA[disabled="true" ]]></xsl:if><![CDATA[type="radio" class="rad" id="crmForm]]><xsl:value-of select="$fieldName" /><xsl:value-of select="position() - 1" /><![CDATA[" name="crmForm]]><xsl:value-of select="$fieldName" /><![CDATA[" value="]]><xsl:value-of select="@value" /><![CDATA["/>]]><![CDATA[</td>]]><![CDATA[<td class="radioLabel"><label for="crmForm]]><xsl:value-of select="$fieldName" /><xsl:value-of select="position() - 1" /><![CDATA[">]]><xsl:value-of select="$optionLabel" /><![CDATA[</label></td>]]></xsl:for-each><![CDATA[</tr>]]><![CDATA[</table>]]><!--
					write out the hidden form input to store the value in
				--><![CDATA[<input type="hidden" name="]]><xsl:value-of select="$fieldName" /><![CDATA["]]><xsl:value-of select="$req" /><xsl:if test="events/event[@name = 'onchange' and @active = 'true']"> onchange="<xsl:value-of select="$fieldName" />_onchange();"</xsl:if><![CDATA[>]]><![CDATA[<xsl:attribute name="value">]]><![CDATA[<xsl:choose>]]><![CDATA[<xsl:when test="]]><xsl:value-of select="$fieldName" /><![CDATA[">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA["/>]]><![CDATA[</xsl:when>]]><![CDATA[<xsl:otherwise>]]><xsl:value-of select="/entity/properties/fields/field[@name = $fieldName]/@defaultvalue" /><![CDATA[</xsl:otherwise>]]><![CDATA[</xsl:choose>]]><![CDATA[</xsl:attribute>]]><![CDATA[</input>]]></xsl:when><!--
				status datatype
			--><xsl:when test="$dataType = 'status'"><xsl:choose><!--
						read only
					--><xsl:when test="$cellState = 'readonly'"><![CDATA[<input type="text" name="]]><xsl:value-of select="$fieldName" /><![CDATA[" disabled="" class="ro">]]><![CDATA[<xsl:attribute name="value">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA[/@name"/>]]><![CDATA[</xsl:attribute>]]><![CDATA[</input>]]></xsl:when><!--
						editable
					--><xsl:otherwise><![CDATA[<span tabbingIndex="]]><xsl:value-of select="$tabIndex" /><![CDATA[" class="selectBox" name="]]><xsl:value-of select="$fieldName" /><![CDATA["]]><xsl:value-of select="$req" /><xsl:if test="events/event[@name = 'onchange' and @active = 'true']"> changeHandler="<xsl:value-of select="$fieldName" />_onchange();"</xsl:if><![CDATA[>]]><![CDATA[<xsl:attribute name="value">]]><![CDATA[<xsl:choose>]]><![CDATA[<xsl:when test="]]><xsl:value-of select="$fieldName" /><![CDATA[">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA["/>]]><![CDATA[</xsl:when>]]><![CDATA[<xsl:otherwise>]]><![CDATA[<xsl:choose>]]><xsl:for-each select="/entity/properties/fields/field[@name = 'statecode']/states/state[@value != '0']"><xsl:variable name="stateCode" select="@value" /><![CDATA[<xsl:when test="statecode = ']]><xsl:value-of select="@value" /><![CDATA['">]]><xsl:value-of select="@defaultstatus" /><![CDATA[</xsl:when>]]></xsl:for-each><![CDATA[<xsl:otherwise>]]><xsl:value-of select="/entity/properties/fields/field[@name = 'statecode']/states/state[@value = 0]/@defaultstatus" /><![CDATA[</xsl:otherwise>]]><![CDATA[</xsl:choose>]]><![CDATA[</xsl:otherwise>]]><![CDATA[</xsl:choose>]]><![CDATA[</xsl:attribute>]]><![CDATA[<table cellspacing="0" cellpadding="2" style="display:none;">]]><![CDATA[<xsl:choose>]]><xsl:for-each select="/entity/properties/fields/field[@name = 'statecode']/states/state[@value != '0']"><xsl:variable name="stateCode" select="@value" /><![CDATA[<xsl:when test="statecode = ']]><xsl:value-of select="$stateCode" /><![CDATA['">]]><xsl:for-each select="/entity/properties/fields/field[@name = $fieldName]/statuses/status[@state = $stateCode]"><![CDATA[<tr>]]><![CDATA[<td nowrap="" val="]]><xsl:value-of select="@value" /><![CDATA[">]]><xsl:choose><xsl:when test="labels/label[@languagecode = $languageCode]"><xsl:value-of select="labels/label[@languagecode = $languageCode]/@description" /></xsl:when><xsl:otherwise><xsl:value-of select="labels/label[@languagecode = 1033]/@description" /></xsl:otherwise></xsl:choose><![CDATA[</td>]]><![CDATA[</tr>]]></xsl:for-each><![CDATA[</xsl:when>]]></xsl:for-each><!--
										always make the first state the default
									--><![CDATA[<xsl:otherwise>]]><xsl:for-each select="/entity/properties/fields/field[@name = $fieldName]/statuses/status[@state = 0]"><![CDATA[<tr>]]><![CDATA[<td nowrap="" val="]]><xsl:value-of select="@value" /><![CDATA[">]]><xsl:choose><xsl:when test="labels/label[@languagecode = $languageCode]"><xsl:value-of select="labels/label[@languagecode = $languageCode]/@description" /></xsl:when><xsl:otherwise><xsl:value-of select="labels/label[@languagecode = 1033]/@description" /></xsl:otherwise></xsl:choose><![CDATA[</td>]]><![CDATA[</tr>]]></xsl:for-each><![CDATA[</xsl:otherwise>]]><![CDATA[</xsl:choose>]]><![CDATA[</table>]]><![CDATA[</span>]]></xsl:otherwise></xsl:choose></xsl:when><!--
				picklist datatype
			--><xsl:when test="$dataType = 'picklist'"><![CDATA[<span ]]><xsl:choose><xsl:when test="$cellState = 'readonly'"><![CDATA[disabled="" ]]></xsl:when><xsl:otherwise><![CDATA[tabbingIndex="]]><xsl:value-of select="$tabIndex" /><![CDATA[" ]]></xsl:otherwise></xsl:choose><![CDATA[class="selectBox" name="]]><xsl:value-of select="$fieldName" /><![CDATA["]]><xsl:value-of select="$req" /><xsl:if test="events/event[@name = 'onchange' and @active = 'true']"> changeHandler="<xsl:value-of select="$fieldName" />_onchange();"</xsl:if><![CDATA[>]]><![CDATA[<xsl:attribute name="value">]]><![CDATA[<xsl:choose>]]><![CDATA[<xsl:when test="]]><xsl:value-of select="$fieldName" /><![CDATA[">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA["/>]]><![CDATA[</xsl:when>]]><![CDATA[<xsl:otherwise>]]><xsl:value-of select="$defaultValue" /><![CDATA[</xsl:otherwise>]]><![CDATA[</xsl:choose>]]><![CDATA[</xsl:attribute>]]><![CDATA[<table cellspacing="0" cellpadding="2" style="display:none;">]]><!--
							if the user wants a blank row, insert it
						--><xsl:if test="/entity/properties/fields/field[@name = $fieldName]/@defaultvalue = ''"><![CDATA[<tr>]]><![CDATA[<td val="">]]><![CDATA[<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>]]><![CDATA[</td>]]><![CDATA[</tr>]]></xsl:if><xsl:for-each select="/entity/properties/fields/field[@name = $fieldName]/options/option"><![CDATA[<tr>]]><![CDATA[<td nowrap="" val="]]><xsl:value-of select="@value" /><![CDATA[">]]><xsl:choose><xsl:when test="labels/label[@languagecode = $languageCode]"><xsl:value-of select="labels/label[@languagecode = $languageCode]/@description" /></xsl:when><xsl:otherwise><xsl:value-of select="labels/label[@languagecode = 1033]/@description" /></xsl:otherwise></xsl:choose><![CDATA[</td>]]><![CDATA[</tr>]]></xsl:for-each><![CDATA[</table>]]><![CDATA[</span>]]></xsl:when><!--
				lookup datatype
			--><xsl:when test="$dataType = 'lookup' or $dataType = 'owner' or $dataType = 'customer'"><xsl:choose><!--
						read only
					--><xsl:when test="$cellState = 'readonly' or $dataType = 'owner'"><![CDATA[<table cellpadding="0" cellspacing="0" width="100%" style="table-layout:fixed;">]]><![CDATA[<tr>]]><![CDATA[<td nowrap="">]]><![CDATA[<div class="lu" style="background-color:#fffbff;border-color:#cccccc;">]]><![CDATA[<xsl:if test="]]><xsl:value-of select="$fieldName" /><![CDATA[/@dsc = 0">]]><![CDATA[<span tabindex="]]><xsl:value-of select="$tabIndex" /><![CDATA[" class="lui"]]><xsl:if test="$dataType = 'lookup'"><![CDATA[ otype="]]><xsl:value-of select="/entity/metadata/fields/field[@name = $fieldName]/@objecttypecode" /><![CDATA["]]></xsl:if><![CDATA[>]]><![CDATA[<xsl:attribute name="oid">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="@name" /><![CDATA["/>]]><![CDATA[</xsl:attribute>]]><xsl:if test="$dataType != 'lookup'"><![CDATA[<xsl:attribute name="otype">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA[/@type"/>]]><![CDATA[</xsl:attribute>]]></xsl:if><![CDATA[<xsl:attribute name="onclick">openlui();</xsl:attribute>]]><![CDATA[<img class="lui"]]><xsl:if test="$dataType = 'lookup'"><![CDATA[ src="../../_imgs/ico_16_]]><xsl:value-of select="/entity/metadata/fields/field[@name = $fieldName]/@objecttypecode" /><![CDATA[.gif"]]></xsl:if><![CDATA[>]]><xsl:if test="$dataType != 'lookup'"><![CDATA[<xsl:attribute name="src">]]><![CDATA[../../_imgs/ico_16_<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA[/@type"/>.gif]]><![CDATA[</xsl:attribute>]]></xsl:if><![CDATA[</img>]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA[/@name"/>]]><![CDATA[</span>]]><![CDATA[</xsl:if>]]><![CDATA[<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>]]><![CDATA[</div>]]><![CDATA[</td>]]><![CDATA[<td width="25" style="text-align: right;">]]><![CDATA[<img src="../../_imgs/btn_dis_lookup.gif" />]]><!--
										write out the hidden fields that actually get written back to the platform
									--><![CDATA[<input crmType="lu" type="hidden" name="]]><xsl:value-of select="@name" /><![CDATA["]]><xsl:if test="$dataType = 'lookup'"><![CDATA[ otype="]]><xsl:value-of select="/entity/metadata/fields/field[@name = $fieldName]/@objecttypecode" /><![CDATA["]]></xsl:if><xsl:value-of select="$req" /><![CDATA[>]]><xsl:if test="$dataType != 'lookup'"><![CDATA[<xsl:if test="]]><xsl:value-of select="$fieldName" /><![CDATA[/@dsc = 0">]]><![CDATA[<xsl:attribute name="otype">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA[/@type"/>]]><![CDATA[</xsl:attribute>]]><![CDATA[</xsl:if>]]></xsl:if><![CDATA[<xsl:attribute name="value">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="@name" /><![CDATA["/>]]><![CDATA[</xsl:attribute>]]><![CDATA[</input>]]><![CDATA[</td>]]><![CDATA[</tr>]]><![CDATA[</table>]]></xsl:when><!--
						editable
					--><xsl:otherwise><![CDATA[<table cellpadding="0" cellspacing="0" width="100%" style="table-layout:fixed;">]]><![CDATA[<tr>]]><![CDATA[<td nowrap="">]]><![CDATA[<div class="lu">]]><![CDATA[<xsl:if test="]]><xsl:value-of select="$fieldName" /><![CDATA[/@dsc = 0">]]><![CDATA[<span tabindex="]]><xsl:value-of select="$tabIndex" /><![CDATA[" class="lui"]]><xsl:if test="$dataType = 'lookup'"><![CDATA[ otype="]]><xsl:value-of select="/entity/metadata/fields/field[@name = $fieldName]/@objecttypecode" /><![CDATA["]]></xsl:if><![CDATA[>]]><![CDATA[<xsl:attribute name="oid">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="@name" /><![CDATA["/>]]><![CDATA[</xsl:attribute>]]><xsl:if test="$dataType != 'lookup'"><![CDATA[<xsl:attribute name="otype">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA[/@type"/>]]><![CDATA[</xsl:attribute>]]></xsl:if><![CDATA[<xsl:attribute name="onclick">openlui();</xsl:attribute>]]><![CDATA[<img class="lui"]]><xsl:if test="$dataType = 'lookup'"><![CDATA[ src="../../_imgs/ico_16_]]><xsl:value-of select="/entity/metadata/fields/field[@name = $fieldName]/@objecttypecode" /><![CDATA[.gif"]]></xsl:if><![CDATA[>]]><xsl:if test="$dataType != 'lookup'"><![CDATA[<xsl:attribute name="src">]]><![CDATA[../../_imgs/ico_16_<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA[/@type"/>.gif]]><![CDATA[</xsl:attribute>]]></xsl:if><![CDATA[</img>]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA[/@name"/>]]><![CDATA[</span>]]><![CDATA[</xsl:if>]]><![CDATA[<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>]]><![CDATA[</div>]]><![CDATA[</td>]]><![CDATA[<td width="25" style="text-align: right;">]]><xsl:choose><xsl:when test="$dataType = 'owner'"><![CDATA[<img tabindex="]]><xsl:value-of select="$tabIndex + 1" /><![CDATA[" class="lu" lookupbrowse="0" lookuptypes="8" lookupstyle="single" lookupclass="BasicOwner" src="../../_imgs/btn_off_lookup.gif"]]><xsl:if test="events/event[@name = 'onclick' and @active = 'true']"> onclick="<xsl:value-of select="$fieldName" />_onclick();"</xsl:if><xsl:if test="events/event[@name = 'setadditionalparams' and @active = 'true']"> setadditionalparams="<xsl:value-of select="$fieldName" />_setadditionalparams();"</xsl:if><xsl:if test="events/event[@name = 'onafterselect' and @active = 'true']"> onafterselect="<xsl:value-of select="$fieldName" />_onafterselect();"</xsl:if><![CDATA[/>]]></xsl:when><xsl:when test="$dataType = 'customer'"><![CDATA[<img tabindex="]]><xsl:value-of select="$tabIndex + 1" /><![CDATA[" class="lu" lookupbrowse="0" lookuptypes="1,2" lookupstyle="single" lookupclass="BasicCustomer" src="../../_imgs/btn_off_lookup.gif"]]><xsl:if test="events/event[@name = 'onclick' and @active = 'true']"> onclick="<xsl:value-of select="$fieldName" />_onclick();"</xsl:if><xsl:if test="events/event[@name = 'setadditionalparams' and @active = 'true']"> setadditionalparams="<xsl:value-of select="$fieldName" />_setadditionalparams();"</xsl:if><xsl:if test="events/event[@name = 'onafterselect' and @active = 'true']"> onafterselect="<xsl:value-of select="$fieldName" />_onafterselect();"</xsl:if><![CDATA[/>]]></xsl:when><xsl:otherwise><![CDATA[<img tabindex="]]><xsl:value-of select="$tabIndex + 1" /><![CDATA[" class="lu" lookupbrowse="]]><xsl:value-of select="/entity/properties/fields/field[@name = $fieldName]/@lookupbrowse" /><![CDATA[" lookupstyle="]]><xsl:value-of select="/entity/properties/fields/field[@name = $fieldName]/@lookupstyle" /><![CDATA[" lookupclass="]]><xsl:value-of select="/entity/properties/fields/field[@name = $fieldName]/@lookupclass" /><![CDATA[" src="../../_imgs/btn_off_lookup.gif"]]><xsl:if test="events/event[@name = 'onclick' and @active = 'true']"> onclick="<xsl:value-of select="$fieldName" />_onclick();"</xsl:if><xsl:if test="events/event[@name = 'setadditionalparams' and @active = 'true']"> setadditionalparams="<xsl:value-of select="$fieldName" />_setadditionalparams();"</xsl:if><xsl:if test="events/event[@name = 'onafterselect' and @active = 'true']"> onafterselect="<xsl:value-of select="$fieldName" />_onafterselect();"</xsl:if><![CDATA[/>]]></xsl:otherwise></xsl:choose><!--
										write out the hidden fields that actually get written back to the platform
									--><![CDATA[<input crmType="lu" type="hidden" name="]]><xsl:value-of select="@name" /><![CDATA["]]><xsl:if test="$dataType = 'lookup'"><![CDATA[ otype="]]><xsl:value-of select="/entity/metadata/fields/field[@name = $fieldName]/@objecttypecode" /><![CDATA["]]></xsl:if><xsl:value-of select="$req" /><![CDATA[>]]><xsl:if test="$dataType != 'lookup'"><![CDATA[<xsl:if test="]]><xsl:value-of select="$fieldName" /><![CDATA[/@dsc = 0">]]><![CDATA[<xsl:attribute name="otype">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA[/@type"/>]]><![CDATA[</xsl:attribute>]]><![CDATA[</xsl:if>]]></xsl:if><![CDATA[<xsl:attribute name="value">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="@name" /><![CDATA["/>]]><![CDATA[</xsl:attribute>]]><![CDATA[</input>]]><![CDATA[</td>]]><![CDATA[</tr>]]><![CDATA[</table>]]></xsl:otherwise></xsl:choose></xsl:when><!--
				integer, float, and money datatypes
			--><xsl:when test="$dataType = 'integer' or $dataType = 'float' or $dataType = 'money'"><![CDATA[<input tabindex="]]><xsl:value-of select="$tabIndex" /><![CDATA[" type="text" maxlength="50" name="]]><xsl:value-of select="$fieldName" /><![CDATA[" min="]]><xsl:value-of select="$minValue" /><![CDATA[" max="]]><xsl:value-of select="$maxValue" /><![CDATA[" grp="]]><xsl:value-of select="$showGrouping" /><![CDATA[" acc="]]><xsl:value-of select="$decAccuracy" /><![CDATA[" dt="]]><![CDATA["]]><xsl:choose><xsl:when test="$cellState = 'readonly'"><![CDATA[ class="ro" disabled=""]]></xsl:when><xsl:otherwise><![CDATA[ class="num"]]></xsl:otherwise></xsl:choose><xsl:value-of select="$req" /><xsl:if test="events/event[@name = 'onchange' and @active = 'true']"> onchange="<xsl:value-of select="$fieldName" />_onchange();"</xsl:if><![CDATA[>]]><![CDATA[<xsl:if test="]]><xsl:value-of select="$fieldName" /><![CDATA[">]]><![CDATA[<xsl:attribute name="value">]]><!--
								numberFormatMask has the following structure "#,##0.*;0#,##0.*"
								We need to replace '*'s with the appropriate number of 0s to specify the accuracy
								For example if the accuracy is three the formatNumberPattern variable will have the value of "#,##0.000;0#,##0.000"
								If the accuracy iz zero (i.e. the number doesn't have antyhing after the decimal point)
								we convert the mask to the following form: "#,##0.#;0#,##0.#"
							--><![CDATA[<xsl:variable name="formatNumberPattern">]]><xsl:choose><xsl:when test="$decAccuracy&gt;0"><![CDATA[<xsl:call-template name="replace">]]><![CDATA[<xsl:with-param name="source" select="$numberFormatMask" />]]><![CDATA[<xsl:with-param name="oldVal" select="'*'" />]]><![CDATA[<xsl:with-param name="newVal" select="']]><xsl:value-of select="substring('0000000000', 1, $decAccuracy)" /><![CDATA['" />]]><![CDATA[</xsl:call-template>]]></xsl:when><xsl:otherwise><![CDATA[<xsl:call-template name="replace">]]><![CDATA[<xsl:with-param name="source" select="$numberFormatMask" />]]><![CDATA[<xsl:with-param name="oldVal" select="'*'" />]]><![CDATA[<xsl:with-param name="newVal" select="'#'" />]]><![CDATA[</xsl:call-template>]]></xsl:otherwise></xsl:choose><![CDATA[</xsl:variable>]]><![CDATA[<xsl:variable name="formattedNumber" select="format-number(]]><xsl:value-of select="$fieldName" /><![CDATA[, $formatNumberPattern, $numberFormat)"/>]]><!--
								replace	'~' sign with the '-' sign
								'~' is used to deal with some strange behavior of the XSLT processor when '-' is used in the pattern
							--><![CDATA[<xsl:value-of select="translate($formattedNumber, '~', '-')"/>]]><![CDATA[</xsl:attribute>]]><![CDATA[</xsl:if>]]><![CDATA[<xsl:attribute name="returnValue">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA["/>]]><![CDATA[</xsl:attribute>]]><![CDATA[</input>]]></xsl:when><!--
				datetime datatype
			--><xsl:when test="$dataType = 'datetime'"><xsl:choose><!--
						read only
					--><xsl:when test="$cellState = 'readonly'"><![CDATA[<input type="text" name="]]><xsl:value-of select="$fieldName" /><![CDATA[" disabled="" class="ro">]]><![CDATA[<xsl:if test="]]><xsl:value-of select="$fieldName" /><![CDATA[">]]><![CDATA[<xsl:attribute name="value">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA[/@date"/>]]><xsl:if test="$format = 'datetime'"><xsl:text disable-output-escaping="no">&lt;![CDATA[ ]]&gt;</xsl:text><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA[/@time"/>]]></xsl:if><![CDATA[</xsl:attribute>]]><![CDATA[</xsl:if>]]><![CDATA[</input>]]></xsl:when><!--
						editable
					--><xsl:otherwise><xsl:choose><!--
								show the date control and time drop down
							--><xsl:when test="$format = 'datetime'"><![CDATA[<table cellpadding="0" cellspacing="0" width="100%" style="table-layout:fixed;">
									<col/><col width="44"/><col/>
									<tr>
										<td>
											<input tabindex="]]><xsl:value-of select="$tabIndex" /><![CDATA[" type="text" crmType="dtm" class="dtm" name="]]><xsl:value-of select="$fieldName" /><![CDATA[" maxlength="10"]]><xsl:value-of select="$req" /><![CDATA[>
												<xsl:attribute name="value">
													<xsl:if test="]]><xsl:value-of select="$fieldName" /><![CDATA["><xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA[/@date"/></xsl:if>
												</xsl:attribute>
												<xsl:attribute name="returnValue">
													<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA["/>
												</xsl:attribute>
											</input>
										</td>
										<td style="padding-left:4px;">
											<img class="dtm" src="../../_imgs/btn_off_cal.gif"/>
										</td>
										<td style="padding-left:4px;">
											<div class='timeedit' timeVisible='True'>
												<xsl:attribute name="TimeFormat">
													<xsl:value-of select="$timeFormat"/>
												</xsl:attribute>
												<span value="" class="selectBox" name="crmForm]]><xsl:value-of select="$fieldName" /><![CDATA[" allowValueEdit="true">
													<xsl:attribute name="value">
														<xsl:value-of select="substring(string(]]><xsl:value-of select="@name" /><![CDATA[), 12, 5)"/>
													</xsl:attribute>
													<table cellspacing="0" cellpadding="2" style="display:none;">
														<xsl:choose>
															<xsl:when test="$timeFormat = 0 or $timeFormat = 1 or $timeFormat = 4 or $timeFormat = 5">
																<tr><td val="00:00">12:00 AM</td></tr>
																<tr><td val="00:30">12:30 AM</td></tr>
																<xsl:choose>
																	<xsl:when test="$timeFormat = 0 or $timeFormat = 4">
																		<tr><td val="01:00">1:00 AM</td></tr>
																		<tr><td val="01:30">1:30 AM</td></tr>
																		<tr><td val="02:00">2:00 AM</td></tr>
																		<tr><td val="02:30">2:30 AM</td></tr>
																		<tr><td val="03:00">3:00 AM</td></tr>
																		<tr><td val="03:30">3:30 AM</td></tr>
																		<tr><td val="04:00">4:00 AM</td></tr>
																		<tr><td val="04:30">4:30 AM</td></tr>
																		<tr><td val="05:00">5:00 AM</td></tr>
																		<tr><td val="05:30">5:30 AM</td></tr>
																		<tr><td val="06:00">6:00 AM</td></tr>
																		<tr><td val="06:30">6:30 AM</td></tr>
																		<tr><td val="07:00">7:00 AM</td></tr>
																		<tr><td val="07:30">7:30 AM</td></tr>
																		<tr><td val="08:00">8:00 AM</td></tr>
																		<tr><td val="09:00">9:00 AM</td></tr>
																		<tr><td val="08:30">8:30 AM</td></tr>
																		<tr><td val="09:30">9:30 AM</td></tr>
																	</xsl:when>
																	<xsl:otherwise>
																		<tr><td val="01:00">01:00 AM</td></tr>
																		<tr><td val="01:30">01:30 AM</td></tr>
																		<tr><td val="02:00">02:00 AM</td></tr>
																		<tr><td val="02:30">02:30 AM</td></tr>
																		<tr><td val="03:00">03:00 AM</td></tr>
																		<tr><td val="03:30">03:30 AM</td></tr>
																		<tr><td val="04:00">04:00 AM</td></tr>
																		<tr><td val="04:30">04:30 AM</td></tr>
																		<tr><td val="05:00">05:00 AM</td></tr>
																		<tr><td val="05:30">05:30 AM</td></tr>
																		<tr><td val="06:00">06:00 AM</td></tr>
																		<tr><td val="06:30">06:30 AM</td></tr>
																		<tr><td val="07:00">07:00 AM</td></tr>
																		<tr><td val="07:30">07:30 AM</td></tr>
																		<tr><td val="08:00">08:00 AM</td></tr>
																		<tr><td val="08:30">08:30 AM</td></tr>
																		<tr><td val="09:00">09:00 AM</td></tr>
																		<tr><td val="09:30">09:30 AM</td></tr>
																	</xsl:otherwise>
																</xsl:choose>
																<tr><td val="10:00">10:00 AM</td></tr>
																<tr><td val="10:30">10:30 AM</td></tr>
																<tr><td val="11:00">11:00 AM</td></tr>
																<tr><td val="11:30">11:30 AM</td></tr>
																<tr><td val="12:00">12:00 PM</td></tr>
																<tr><td val="12:30">12:30 PM</td></tr>
																<tr><td val="13:00">13:00 PM</td></tr>
																<tr><td val="13:30">13:30 PM</td></tr>
																<tr><td val="14:00">14:00 PM</td></tr>
																<tr><td val="14:30">14:30 PM</td></tr>
																<tr><td val="15:00">15:00 PM</td></tr>
																<tr><td val="15:30">15:30 PM</td></tr>
																<tr><td val="16:00">16:00 PM</td></tr>
																<tr><td val="16:30">16:30 PM</td></tr>
																<tr><td val="17:00">17:00 PM</td></tr>
																<tr><td val="17:30">17:30 PM</td></tr>
																<tr><td val="18:00">18:00 PM</td></tr>
																<tr><td val="18:30">18:30 PM</td></tr>
																<tr><td val="19:00">19:00 PM</td></tr>
																<tr><td val="19:30">19:30 PM</td></tr>
																<tr><td val="20:00">20:00 PM</td></tr>
																<tr><td val="20:30">20:30 PM</td></tr>
																<tr><td val="21:00">21:00 PM</td></tr>
																<tr><td val="21:30">21:30 PM</td></tr>
																<tr><td val="22:00">22:00 PM</td></tr>
																<tr><td val="22:30">22:30 PM</td></tr>
																<tr><td val="23:00">23:00 PM</td></tr>
																<tr><td val="23:30">23:30 PM</td></tr>
															</xsl:when>
															<xsl:otherwise>
																<xsl:choose>
																	<xsl:when test="$timeFormat = 2 or $timeFormat = 6">
																		<tr><td val="00:00">0:00</td></tr>
																		<tr><td val="00:30">0:30</td></tr>
																		<tr><td val="01:00">1:00</td></tr>
																		<tr><td val="01:30">1:30</td></tr>
																		<tr><td val="02:00">2:00</td></tr>
																		<tr><td val="02:30">2:30</td></tr>
																		<tr><td val="03:00">3:00</td></tr>
																		<tr><td val="03:30">3:30</td></tr>
																		<tr><td val="04:00">4:00</td></tr>
																		<tr><td val="04:30">4:30</td></tr>
																		<tr><td val="05:00">5:00</td></tr>
																		<tr><td val="05:30">5:30</td></tr>
																		<tr><td val="06:00">6:00</td></tr>
																		<tr><td val="06:30">6:30</td></tr>
																		<tr><td val="07:00">7:00</td></tr>
																		<tr><td val="07:30">7:30</td></tr>
																		<tr><td val="08:00">8:00</td></tr>
																		<tr><td val="08:30">8:30</td></tr>
																		<tr><td val="09:00">9:00</td></tr>
																		<tr><td val="09:30">9:30</td></tr>
																	</xsl:when>
																	<xsl:otherwise>
																		<tr><td val="00:00">00:00</td></tr>
																		<tr><td val="00:30">00:30</td></tr>
																		<tr><td val="01:00">01:00</td></tr>
																		<tr><td val="01:30">01:30</td></tr>
																		<tr><td val="02:00">02:00</td></tr>
																		<tr><td val="02:30">02:30</td></tr>
																		<tr><td val="03:00">03:00</td></tr>
																		<tr><td val="03:30">03:30</td></tr>
																		<tr><td val="04:00">04:00</td></tr>
																		<tr><td val="04:30">04:30</td></tr>
																		<tr><td val="05:00">05:00</td></tr>
																		<tr><td val="05:30">05:30</td></tr>
																		<tr><td val="06:00">06:00</td></tr>
																		<tr><td val="06:30">06:30</td></tr>
																		<tr><td val="07:00">07:00</td></tr>
																		<tr><td val="07:30">07:30</td></tr>
																		<tr><td val="08:00">08:00</td></tr>
																		<tr><td val="08:30">08:30</td></tr>
																		<tr><td val="09:00">09:00</td></tr>
																		<tr><td val="09:30">09:30</td></tr>
																	</xsl:otherwise>
																</xsl:choose>
																<tr><td val="10:00">10:00</td></tr>
																<tr><td val="10:30">10:30</td></tr>
																<tr><td val="11:00">11:00</td></tr>
																<tr><td val="11:30">11:30</td></tr>
																<tr><td val="12:00">12:00</td></tr>
																<tr><td val="12:30">12:30</td></tr>
																<tr><td val="13:00">13:00</td></tr>
																<tr><td val="13:30">13:30</td></tr>
																<tr><td val="14:00">14:00</td></tr>
																<tr><td val="14:30">14:30</td></tr>
																<tr><td val="15:00">15:00</td></tr>
																<tr><td val="15:30">15:30</td></tr>
																<tr><td val="16:00">16:00</td></tr>
																<tr><td val="16:30">16:30</td></tr>
																<tr><td val="17:00">17:00</td></tr>
																<tr><td val="17:30">17:30</td></tr>
																<tr><td val="18:00">18:00</td></tr>
																<tr><td val="18:30">18:30</td></tr>
																<tr><td val="19:00">19:00</td></tr>
																<tr><td val="19:30">19:30</td></tr>
																<tr><td val="20:00">20:00</td></tr>
																<tr><td val="20:30">20:30</td></tr>
																<tr><td val="21:00">21:00</td></tr>
																<tr><td val="21:30">21:30</td></tr>
																<tr><td val="22:00">22:00</td></tr>
																<tr><td val="22:30">22:30</td></tr>
																<tr><td val="23:00">23:00</td></tr>
																<tr><td val="23:30">23:30</td></tr>
															</xsl:otherwise>
														</xsl:choose>
													</table>
												</span>
											</div>
										</td>
									</tr>
								</table>]]></xsl:when><xsl:otherwise><![CDATA[<table cellpadding="0" cellspacing="0" width="100%" style="table-layout:fixed;">
									<col/><col width="40"/>
									<tr>
										<td>
											<input tabindex="]]><xsl:value-of select="$tabIndex" /><![CDATA[" type="text" crmType="dtm" class="dtm" name="]]><xsl:value-of select="$fieldName" /><![CDATA[" maxlength="10"]]><xsl:value-of select="$req" /><![CDATA[>
												<xsl:attribute name="value">
													<xsl:if test="]]><xsl:value-of select="$fieldName" /><![CDATA["><xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA[/@date"/></xsl:if>
												</xsl:attribute>
												<xsl:attribute name="returnValue">
													<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA["/>
												</xsl:attribute>
											</input>
										</td>
										<td style="padding-left:4px;">
											<img class="dtm" id="crmTestId]]><xsl:value-of select="$fieldName" /><![CDATA[Img" src="../../_imgs/btn_off_cal.gif"/>
										</td>
									</tr>
								</table>]]></xsl:otherwise></xsl:choose></xsl:otherwise></xsl:choose></xsl:when><!--
				memo datatype
			--><xsl:when test="$dataType = 'memo'"><![CDATA[<textarea tabindex="]]><xsl:value-of select="$tabIndex" /><![CDATA[" rows="4" name="]]><xsl:value-of select="$fieldName" /><![CDATA[" maxlength="]]><xsl:value-of select="$maxLength" /><![CDATA["]]><xsl:if test="$cellState = 'readonly'"><![CDATA[ disabled="" class="ro"]]></xsl:if><xsl:value-of select="$req" /><![CDATA[>]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA["/>]]><![CDATA[</textarea>]]></xsl:when><!--
				text datatype
			--><xsl:when test="$dataType = 'text'"><xsl:choose><xsl:when test="$format = 'textarea'"><![CDATA[<textarea tabindex="]]><xsl:value-of select="$tabIndex" /><![CDATA[" rows="4" name="]]><xsl:value-of select="$fieldName" /><![CDATA[" maxlength="]]><xsl:value-of select="$maxLength" /><![CDATA["]]><xsl:if test="$cellState = 'readonly'"><![CDATA[ disabled="" class="ro"]]></xsl:if><xsl:value-of select="$req" /><![CDATA[>]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA["/>]]><![CDATA[</textarea>]]></xsl:when><xsl:otherwise><![CDATA[<input tabindex="]]><xsl:value-of select="$tabIndex" /><![CDATA[" type="text" name="]]><xsl:value-of select="$fieldName" /><![CDATA[" maxlength="]]><xsl:choose><xsl:when test="$format = 'url'"><xsl:value-of select="$maxLength - 7" /></xsl:when><xsl:otherwise><xsl:value-of select="$maxLength" /></xsl:otherwise></xsl:choose><![CDATA["]]><xsl:choose><xsl:when test="$cellState = 'readonly'"><![CDATA[ disabled="" class="ro"]]></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="$format = 'email'"> class="eml"</xsl:when><xsl:when test="$format = 'tickersymbol'"> class="tkr"</xsl:when><xsl:when test="$format = 'url'"> class="url"</xsl:when></xsl:choose></xsl:otherwise></xsl:choose><xsl:value-of select="$req" /><xsl:if test="events/event[@name = 'onchange' and @active = 'true']"> onchange="<xsl:value-of select="$fieldName" />_onchange();"</xsl:if><![CDATA[>]]><![CDATA[<xsl:attribute name="value">]]><![CDATA[<xsl:value-of select="]]><xsl:value-of select="$fieldName" /><![CDATA["/>]]><![CDATA[</xsl:attribute>]]><![CDATA[</input>]]></xsl:otherwise></xsl:choose></xsl:when><!--
				not a recognized datatype
			--><xsl:otherwise><![CDATA[<input type="text" value="Coming Soon..." disabled="" />]]></xsl:otherwise></xsl:choose><![CDATA[</td>]]></xsl:template>
</xsl:stylesheet>